button ID scgad COMMAND """scgad""" PORT EZHOMEPREFS LABEL "Set Clock"
label CENTER "\033bCM11A Status"
text ID CM1
text ID CM2
text ID CM3
text ID CM4
button COMMAND """statusreq""" PORT EZHOMEPREFS LABEL "Status Update"
endgroup
group
group FRAME
group HORIZ
label "Test Shell"
check ID tstsx COMMAND """tstsx""" PORT EZHOMEPREFS ATTRS MUIA_Selected ptstsw HELP """Determines whether or not\na console is opened when\ntesting actions."""
endgroup
endgroup
button ID svglb COMMAND """svglb""" PORT EZHOMEPREFS LABEL "Save Settings"
endgroup
endgroup
endgroup
endgroup
group HORIZ
label "EZHome Daemon Control"
if showlist('P','EZHOME') then do
address EZHomeMUI
button ID ezhd COMMAND """ezhd""" PORT EZHOMEPREFS HELP """EZHome daemon switch""" LABEL "Active"
end
if ~showlist('P', 'EZHOME') then do
address EZHomeMUI
button ID ezhd COMMAND """ezhd""" PORT EZHOMEPREFS HELP """EZHome daemon switch""" LABEL "Inactive"
end
if showlist('A', 'EZCRON')then do
button ID ezcron COMMAND """ezcron""" PORT EZHOMEPREFS HELP """Call EZCron Prefs""" LABEL "EZCron"
end
/*button ID abt COMMAND """about""" PORT EZHOMEPREFS HELP """EZHome, by \nEZSoft""" LABEL "About"*/
endgroup
endwindow
/*callhook ID DCSTR COMMAND """string ID DCSTR CONTENT %s""" PORT EZHOMEMUI ATTRS MUIA_List_Active MUIV_EveryTime*/
cycle ID hcpref LABELS pdefhouse /* reset the monitored housecode gad */
cycle ID rcyc LABELS pdefhouse /* reset the realtime housecode gad */
list ID LIST1 ATTRS MUIA_List_Quiet 1 /* Disable listview redraw */
do qq = 1 to next
list ID LIST1 INSERT POS STRING MUIV_List_Insert_Bottom STRING pdesc.qq
end
if user.0 ~= 0 then do
do qq = 1 to user.0 /* Write Macro Listview */
list ID LIST2 INSERT POS MUIV_List_Insert_Bottom STRING username.qq
end
end
list ID LIST1 ATTRS MUIA_List_Quiet 0
callhook ID LIST1 COMMAND """LIST1""" PORT EZHOMEPREFS ATTRS MUIA_List_Active MUIV_EveryTime
call openport('EZHOMEPREFS')
if showlist('P', EZHOME) then do
call statusrep()
call devstatus()
end
/* ========================== MAIN LOOP ======================== */
waitforpkt:
do forever
vpkt = 0
address EZHOMEPREFS
call waitpkt('EZHOMEPREFS') /* Wait for a message from the daemon */
packet = getpkt('EZHOMEPREFS') /* Get the message */
if packet ~= '00000000'x then do /* This is not a null message */
vpkt = 1
class = getarg(packet) /* Get the information about the message */
if disclose = 1 then say 'Class =' class /* This MIGHT have been Jim Lucia's auto-open shell! */
if pos('StatusReturn',class) > 0 then do
if words(class) > 1 then do
stat.9 = word(class, 2)
stat.10 = word(class, 3)
devstat1 = x2c(left(stat.9, 2))
devstat2 = x2c(right(stat.9, 2))
dimbyte1 = x2c(left(stat.10, 2))
dimbyte2 = x2c(right(stat.10, 2))
CM11A_Time = word(class, 4)
CM11A_Day = word(class, 5)
CM11A_DayNum = word(class, 6)
CM11A_Rev = word(class, 7)
battimer = word(class, 8)
rethouse = word(class, 9)
EZHomeD_Ver = word(class, 10)
EZHome_Reg = 'EzHome 'substr(class,50+length(battimer)) /* Compensate for battertime strlen */
if vpkt = 1 then call reply(packet,0);vpkt=0
call devstatus()
end
end
/* Actions Window */
if class = 'args' then call args()
if class = 'hc' then call hc()
if class = 'uc' then call uc()
if class = 'fnc' then call fnc()
if class = 'descstr' then call descstr2()
if class = list1 then call list1()
if class = 'adgad' then call adgad()
if class = 'newgd' then call newgd()
if class = 'dlgad' then call delete()
if class = 'fresh' then call refresh(0)
if class = 'refresh' then call refresh(1)
if class = 'svgad' then call svgad()
if class = 'ldgad' then call ldgad()
if class = 'test' then call test()
if class = 'ezhd' then call ezhd()
if class = 'about' then call about()
if class = quit then call exiting()
if class = 'ezcron' then do
if exists('EZCron:ezmui') then address command 'run >NIL: execute EZCron:ezmui'
end
/* Prefs Window */
if class = 'sethouse' then call sethouse()
if class = 'svglb' then call saveprefs()
if class = 'scgad' then call setclock()
if class = 'batgd' then call batteryrst()
/* Realtime Window */
if class = 'realhouse' then call labels()
if class = list2 then call list2()
if class = rdims then call rdims() /* TEMPORARY and no such function! */
/* this loop below is doing it the hard way but requires fixes in _on and _dimit for complete speedup */
/* it should be done like this: */
if pos('_',class) then do
if pos('_ON',class)= 1 then do
qq = substr(class,4)
call _on(qq)
end
if pos('_DM',class)= 1 then do
qq = substr(class,4)
call _dimit(qq)
end
end
if class = 'ralllightson' then call rAllLightsOn()
if class = 'ralllightsoff' then call rAllLightsOff()
if class = 'rallunitsoff' then call rAllUnitsOff()
if class = 'statusreq' then call statusrep()
/* Macro Stuff */
if class = 'addmacro' then call AddMacro()
if class = cancelreq1 then call CancelWin(AddMacWindow)
if class = 'delmacro' then call DelMacro() /* is dummy return */
if showlist('P', EZHOME) then address EZHOME readprefs
return
setclock:
if vpkt = 1 then call reply(packet,0);vpkt=0
if showlist('P', EZHOME) then address EZHOME setclock
return
batteryrst:
if vpkt = 1 then call reply(packet,0);vpkt=0
if showlist('P', EZHOME) then do
address EZHOMEMUI
request TITLE '"Battery Timer Reset"' GADGETS '"Yes|Cancel"' '"\033cThis command should only be\nissued after installing new batteries.\nAre you sure?"'